/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kylingroup.J2SE.Thread;

import java.util.Date;

/**
 *
 * @author kylin
 */
public class TestThreadInterrupt {
    public static void main(String args[]){
        MyThread thread=new MyThread();
        thread.start();
        try{
            Thread.sleep(10000);
        }catch(InterruptedException e){
        }
        thread.interrupt();
    }
}

class MyThread extends Thread{
    public void run(){
        while(true){
            System.out.println("==="+new Date()+"===");
            try{
                sleep(1000);
            }catch(InterruptedException e){
                return;
            }
        }
    }
}